package com.edu.user.service.impl;

import com.api.video.VideoClient;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.edu.entity.HfdClassSkuInfo;
import com.edu.entity.HfdVideoInfo;
import com.edu.user.mapper.HfdClassSkuInfoMapper;
import com.edu.user.service.IHfdClassSkuInfoService;
import com.edu.vo.PageResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jr
 * @since 2021-04-24
 */
@Service
public class HfdClassSkuInfoServiceImpl extends ServiceImpl<HfdClassSkuInfoMapper, HfdClassSkuInfo> implements IHfdClassSkuInfoService {

    @Override
    public PageResultVO<HfdClassSkuInfo> getClassSkuList(Integer currentPage, Integer pageSize, String name) {
        //设置分页信息
        IPage<HfdClassSkuInfo> iPage = new Page(currentPage, pageSize);

        //条件构造器
        QueryWrapper<HfdClassSkuInfo> queryWrapper = new QueryWrapper<>();
        if (!StringUtils.isEmpty(name)) {
            queryWrapper.eq("title", name);
        }

        IPage pageInfo = this.baseMapper.selectPage(iPage, queryWrapper);

        return new PageResultVO<HfdClassSkuInfo>(0, "视频信息查询", pageInfo.getTotal(), pageInfo.getRecords());
    }
}
